package com.gph.saviorframework.es.core.facet.request;

import com.gph.saviorframework.es.core.facet.FacetRequest;
import org.elasticsearch.search.aggregations.bucket.histogram.DateHistogramInterval;

@Deprecated
public class HistogramFacetRequestBuilder {

	HistogramFacetRequest result;

	public HistogramFacetRequestBuilder(String name) {
		result = new HistogramFacetRequest(name);
	}

	public HistogramFacetRequestBuilder field(String field) {
		result.setField(field);
		return this;
	}

	public HistogramFacetRequestBuilder interval(long interval) {
		result.setInterval(interval);
		return this;
	}

	public HistogramFacetRequestBuilder timeUnit(DateHistogramInterval timeUnit) {
		result.setTimeUnit(timeUnit);
		return this;
	}

	public FacetRequest build() {
		return result;
	}

	public HistogramFacetRequestBuilder applyQueryFilter() {
		result.setApplyQueryFilter(true);
		return this;
	}
}